import { formatHeader } from 'plugins/utils.js'
import { getFormatData } from 'plugins/common.js'

export function headerSuccess (state, payload) {
  let header = JSON.parse(payload)
  state.columns = formatHeader(header)
}

export function loadTableSuccess (state, payload) {
  state.tableData = payload.results
  state.serverPagination.rowsNumber = payload.count
  state.loading = false
}

export function openSuccess (state, payload) {
  state.viewSalt.minion_id = payload['minion_id']
  state.viewSalt.grains = getFormatData(payload['grains'])
}
